2 <TITLE>Linear probing hashing: search
7 <A HREF="../../images/handbook.gif"><IMG SRC="../../images/handbook2.gif" align=left></A>
8 <A HREF="../../hbook.html">
9 <IMG SRC="../../images/home_g.gif" hspace = 15 vspace = 4 ALT = "[Home]"></A><BR>
10 <A HREF="../../search_a.html">
11 <IMG SRC="../../images/chapter_g.gif" hspace = 15 vspace = 4 ALT = "[Chapter]"></A><BR>
12 <A HREF="../../expand.html">
13 <IMG SRC="../../images/contents_g.gif" hspace = 15 vspace = 4 ALT = "[Contents]"></A><BR>
14 <A HREF="334.srch.c.html">
16 <A HREF="334.srch.c.html">
17 <IMG SRC="../../images/prevalg_g.gif" hspace = 15 vspace = 4 ALT = "[Previous Algorithm]"></A><BR>
18 <A HREF="335.ins.c.html">
19 <IMG SRC="../../images/nextalg_g.gif" hspace = 15 vspace = 4 ALT = "[Next Algorithm]"></A><BR>
22 <H2><B>Linear probing hashing: search
31 function search( key : typekey; var r : dataarray ) : integer;
32 var i, last : integer;
35 i := hashfunction( key ) ;
36 last := (i+n-1) mod m;
37 while (i<>last) and (not empty(r[i])) and (r[i].k<>key) do
39 if r[i].k=key then search := i {*** found(r[i]) ***}
40 else search := -1; {*** notfound(key) ***}
42 </XMP></TD></TR></TABLE>
44 <H3><A HREF="ftp://sunsite.dcc.uchile.cl/pub/users/rbaeza/handbook/algs/3/334.srch.c"><IMG SRC="../../images/ftp.xbm" hspace=10>C</A> source (334.srch.c) <A HREF="ftp://sunsite.dcc.uchile.cl/pub/users/rbaeza/handbook/algs/3/334.srch.p"><IMG SRC="../../images/ftp.xbm" hspace=10>Pascal</A> source (334.srch.p)
47 <IMG SRC="../../images/aw3.gif" align=left><H5><BR>
48 © <A HREF="http://aw.com">Addison-Wesley </A>Publishing Co. Inc.